#include "../../libraries/sockets/tcp_server.h"
#include <iostream>

using namespace std; 

int main(int argc, char *argv[])

{
    if (argc<2){
        cout <<"use: ./server portno" <<endl;
        exit(1);
    }

    int n;
    string message, answer;
    TCP_server server(atoi (argv[1]), 20);

    while (1){

        if(server.accept()==0)
        {

        server>>message;

        cout << "Client says: " << endl << message << endl;

        cout << "Write a message for the client: " << endl;

        cin >> answer;

        server<<answer;

	exit(0);

        }

    }
return 0;
}
